package resolver

// This file will be automatically regenerated based on the schema, any resolver implementations
// will be copied through when generating and any unknown code will be moved to the end.

import (
	"context"
	"fmt"
	"gqlt2/graph/model"

	"github.com/dgryski/trifles/uuid"
)

func (r *mutationResolver) CreateDrivingLog(ctx context.Context, input model.CreateDrivingLogParam) (*model.DrivingLog, error) {
	return &model.DrivingLog{DrivingLogID: uuid.UUIDv4()}, nil
}

func (r *mutationResolver) AuditDrivingLog(ctx context.Context, input model.AuditDrivingLogParam) (*model.DrivingLog, error) {
	return &model.DrivingLog{DrivingLogID: uuid.UUIDv4()}, nil
}

func (r *mutationResolver) UpdateDrivingLog(ctx context.Context, input model.UpdateDrivingLogParam) (*model.DrivingLog, error) {
	return &model.DrivingLog{DrivingLogID: uuid.UUIDv4()}, nil
}

func (r *mutationResolver) ExportDrivingLog(ctx context.Context, input model.DrivingLogExportParam) (string, error) {
	return "http://ccc.dasdada.ccc/www.xlsx", nil
}

func (r *mutationResolver) RemoveDrivingLog(ctx context.Context, input model.RemoveDrivingLogParam) (*model.DrivingLog, error) {
	return &model.DrivingLog{DrivingLogID: uuid.UUIDv4()}, nil
}

func (r *queryResolver) DrivingLogList(ctx context.Context, query model.DrivingLogListQuery) (*model.DrivingLogConnection, error) {
	fmt.Println(query)
	return &model.DrivingLogConnection{
		PageInfo: &model.PageInfo{Total: 100},
		Nodes: []*model.DrivingLog{
			&model.DrivingLog{
				DrivingLogID: uuid.UUIDv4(),
				Driver:       &model.Driver{DriverID: uuid.UUIDv4()},
			},
		},
	}, nil
}
